package leetcode_周赛._2021._202107._20210704;

import java.util.Arrays;

/**
 * @author yzh
 * @version 1.0
 * @date 2021/7/4 10:39
 * 消灭怪物的最大数量
 * 算法：数组  贪心
 */
public class _5801 {

    public int eliminateMaximum(int[] dist, int[] speed) {
        for (int i = 0; i < dist.length; i++) {
            int t = dist[i] % speed[i];
            dist[i] = t == 0 ? dist[i] / speed[i] : dist[i] / speed[i] + 1;
        }
        Arrays.sort(dist);
        int ans = 0;
        for (int i = 0; i < dist.length; i++) {
            if (i < dist[i]) ++ans;
            else break;
        }
        return ans;
    }

}
